<template>
  <div class="test">
    <h1>欢迎进入---{{ title }}</h1>
    <router-link to="/home">home</router-link>---
    <router-link to="/login">login</router-link>
    <router-view></router-view>
  </div>
</template>
<script>
export default {
  data() {
    return {
      title: ''
    }
  },
  watch: {
    $route(newVal) {
      console.log(newVal)
      if (newVal.path === '/home') {
        this.title = newVal.meta.title
      }
    }
  }
}
</script>
<style lang="scss" scoped></style>
